package main.core;



import main.gameInfo.gameInfo;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Rect;

public class ship {

	private int x, y, width, height, qtdSlots;
	private boolean selected = false;
	private Bitmap texture;

	
	public ship(int x, int y, int width, int height, int qtdSlots, Bitmap texture){
		this.x = x;
		this.y = y;
		this.width = width;
		this.height = height;	
		this.qtdSlots = qtdSlots;
		this.texture = texture;
	}
	
	public void update(long diffTime)
	{
		
	}
	
	public void onDraw(Canvas canvas){		
		Paint p = new Paint();
		p.setColor(Color.YELLOW);
		
		
		Rect pos = new Rect( x, y,  x+gameInfo.ESPACAMENTO, y+gameInfo.ESPACAMENTO*this.qtdSlots );
		canvas.drawBitmap( texture, new Rect( 0, 0, texture.getWidth(), texture.getHeight() ), pos, p);
	
//		if(!selected){		
//			canvas.drawRect(new Rect(x, y, x+width, y+height), p);
//		}else
//		{
//			p.setColor(Color.GREEN);
//			canvas.drawRect(new Rect(x, y, x+width, y+height), p);
//		}
		
	}
	
	public boolean checkClickColision(int xTouch, int yTouch){
		if((xTouch > this.x && xTouch < this.x + this.width) && (yTouch > this.y && yTouch < this.y + height)){
			System.out.println("Nave selecionada");
			//selected = true;
			return true;
		}
		else	
			return false;
		
	}
	
	public void setPosition(int x, int y){
		this.x = x;
		this.y = y;
	}
	
	public void desSelect(){
		selected = false;
	}
	public void selected(){
		this.selected = true;
	}
	
	public boolean isSeleted(){
		if(this.selected == true)
			return true;
		else
			return false;
	}
	
	public int getQtdSlots(){
		return qtdSlots;
	}
	
	public void setWidth(int width){
		this.width = width;
	}
	
	public void setHeight(int height){
		this.height = height;
	}
	
}
